#include  <iostream>
using  namespace  std;

class Point2D
{
public:
    Point2D( double x=0,double y=0):m_x(x),m_y(y)
    {

    }
    void print()
    {
        cout<<"Point2D is ("<<m_x<<" , "<<m_y<<")\n";
    }
protected:
    double m_x,m_y;
};
class Point3D:public Point2D
{
public:
    Point3D( double x=0,double y=0,double z=0):Point2D(x,y),m_z(z)
    {

    }
    void print()
    {
        cout<<"Point3D is ("<<m_x<<" , "<<m_y<<" , "<< m_z<<")\n";
    }
protected:
    double m_z;
};
int main()
{
    Point3D obj3d(1,2,3);
    obj3d.print();

    Point2D obj2d=obj3d;
    obj2d.print();

    Point2D *pobj2d=&obj3d;
    pobj2d->print();

    Point2D &robj2d=obj3d;
    robj2d.print();
}
/*
int main()
{
    Point2D obj2D[2]= {Point2D(1,2),Point2D(3,4)};
    Point3D obj3D[2]= {Point3D(0,1,2),Point3D(5,3,4)};
    for(int i=0; i<2; i++)
        obj2D[i].print();
    for(int i=0; i<2; i++)
        obj3D[i].print();
}
*/

/*
int main()
{
    Point2D *parr[5];
    parr[0]=new Point2D(2,3);
    parr[1]=new Point3D(6,7,9);
    parr[2]=new Point2D(1,4);
    parr[3]=new Point3D(11,8,7);
    parr[4]=new Point2D(-2,0);
    for(int i=0;i<5;i++)
        parr[i]->print();
    for(int i=0;i<5;i++)
        delete parr[i];
}
*/